package ch.ffhs.ks.model;

import java.io.Serializable;
import java.util.ArrayList;

public class Account implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8683263244765346176L;

	private String imapAddress;
	private int imapPort;
	private String emailAddress;
	private String password;
	private String smptAddress;
	private int smtpPort;

	private ArrayList<Folder> folders = new ArrayList<Folder>();

	public boolean needsUpdate()
	{
		return true;
	}

	public ArrayList<Folder> getFolders(){
		return folders;
	}

	public String getImapAddress() {
		return imapAddress;
	}
	public void setimapAddress(String imapAddress) {
		this.imapAddress = imapAddress;
	}
	public int getImapPort() {
		return imapPort;
	}
	public void setimapPort(int imapPort) {
		this.imapPort = imapPort;
	}
	public String getEmailAddress() {
		return emailAddress;
	}
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public String toString() {
		return getEmailAddress();
	}

	public String getSmtpAddress() {
		return smptAddress;
	}

	public void setSmptAddress(String smptAddress) {
		this.smptAddress = smptAddress;
	}

	public int getSmtpPort() {
		return smtpPort;
	}

	public void setSmtpPort(int smtpPort) {
		this.smtpPort = smtpPort;
	}

	public void addFolder(ch.ffhs.ks.model.Folder f) {

		if(!folders.contains(f))
		{
			folders.add(f);
		}
	}

	public boolean containsMail(Mail mail) {
		for(Folder folder : folders)
		{
			if(folder.containsMail(mail))
			{
				return true;
			}
		}
		return false;
	}


}
